Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge branch 'yoko_auxilliary_stream_format' into 'ibm-trunk'
Yoko auxilliary stream format See merge request !54
- Loading branch information
Showing
5 changed files
with
228 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,71 @@ | ||
package org.apache.yoko.orb.yasf; | ||
|
||
import java.util.BitSet; | ||
|
||
import org.omg.IOP.ServiceContext; | ||
import org.omg.IOP.TaggedComponent; | ||
|
||
public enum Yasf { | ||
; | ||
|
||
// TODO - Get ids from OMG assigned for these values | ||
public static final int TAG_YOKO_AUXILLIARY_STREAM_FORMAT = 0xeeeeeeee; | ||
public static final int YOKO_AUXIllIARY_STREAM_FORMAT_SC = 0xeeeeeeee; | ||
|
||
public final int itemIndex; | ||
|
||
private Yasf(int itemIndex) { | ||
this.itemIndex = itemIndex; | ||
} | ||
|
||
public boolean isSet(BitSet items) { | ||
return items.get(itemIndex); | ||
} | ||
|
||
public static Builder build() { | ||
return new BuilderImpl(); | ||
} | ||
|
||
public static BitSet readData(byte[] data) { | ||
return BitSet.valueOf(data); | ||
} | ||
|
||
public interface Builder { | ||
public Builder set(Yasf... items); | ||
public Builder clear(Yasf... items); | ||
public TaggedComponent tc(); | ||
public ServiceContext sc(); | ||
} | ||
|
||
private static final class BuilderImpl implements Builder { | ||
private final BitSet bits = new BitSet(); | ||
|
||
BuilderImpl() {} | ||
|
||
@Override | ||
public Builder set(Yasf... items) { | ||
for (Yasf item: items) { | ||
bits.set(item.itemIndex); | ||
} | ||
return this; | ||
} | ||
|
||
@Override | ||
public Builder clear(Yasf... items) { | ||
for (Yasf item: items) { | ||
bits.clear(item.itemIndex); | ||
} | ||
return this; | ||
} | ||
|
||
@Override | ||
public TaggedComponent tc() { | ||
return new TaggedComponent(TAG_YOKO_AUXILLIARY_STREAM_FORMAT, bits.toByteArray()); | ||
} | ||
|
||
@Override | ||
public ServiceContext sc() { | ||
return new ServiceContext(YOKO_AUXIllIARY_STREAM_FORMAT_SC, bits.toByteArray()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,53 @@ | ||
package org.apache.yoko.orb.yasf; | ||
|
||
import java.io.IOException; | ||
import java.io.NotSerializableException; | ||
import java.io.ObjectInputStream; | ||
import java.io.ObjectOutputStream; | ||
|
||
import org.omg.CORBA.LocalObject; | ||
import org.omg.PortableInterceptor.ClientRequestInfo; | ||
import org.omg.PortableInterceptor.ClientRequestInterceptor; | ||
import org.omg.PortableInterceptor.ForwardRequest; | ||
|
||
public class YasfClientInterceptor extends LocalObject implements ClientRequestInterceptor { | ||
private static final String NAME = YasfClientInterceptor.class.getName(); | ||
|
||
@Override | ||
public void send_request(ClientRequestInfo ri) throws ForwardRequest { | ||
ri.add_request_service_context(Yasf.build().sc(), false); | ||
} | ||
|
||
@Override | ||
public void send_poll(ClientRequestInfo ri) { | ||
} | ||
|
||
@Override | ||
public void receive_reply(ClientRequestInfo ri) { | ||
} | ||
|
||
@Override | ||
public void receive_exception(ClientRequestInfo ri) throws ForwardRequest { | ||
} | ||
|
||
@Override | ||
public void receive_other(ClientRequestInfo ri) throws ForwardRequest { | ||
} | ||
|
||
@Override | ||
public String name() { | ||
return NAME; | ||
} | ||
|
||
@Override | ||
public void destroy() { | ||
} | ||
|
||
private void readObject(ObjectInputStream ios) throws IOException { | ||
throw new NotSerializableException(NAME); | ||
} | ||
|
||
private void writeObject(ObjectOutputStream oos) throws IOException { | ||
throw new NotSerializableException(NAME); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,36 @@ | ||
package org.apache.yoko.orb.yasf; | ||
|
||
import java.io.IOException; | ||
import java.io.NotSerializableException; | ||
import java.io.ObjectInputStream; | ||
import java.io.ObjectOutputStream; | ||
|
||
import org.omg.CORBA.LocalObject; | ||
import org.omg.PortableInterceptor.IORInfo; | ||
import org.omg.PortableInterceptor.IORInterceptor; | ||
|
||
public class YasfIORInterceptor extends LocalObject implements IORInterceptor { | ||
private static final String NAME = YasfIORInterceptor.class.getName(); | ||
|
||
@Override | ||
public void establish_components(IORInfo info) { | ||
info.add_ior_component(Yasf.build().tc()); | ||
} | ||
|
||
@Override | ||
public String name() { | ||
return NAME; | ||
} | ||
|
||
@Override | ||
public void destroy() { | ||
} | ||
|
||
private void readObject(ObjectInputStream ios) throws IOException { | ||
throw new NotSerializableException(NAME); | ||
} | ||
|
||
private void writeObject(ObjectOutputStream oos) throws IOException { | ||
throw new NotSerializableException(NAME); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,55 @@ | ||
package org.apache.yoko.orb.yasf; | ||
|
||
import java.io.IOException; | ||
import java.io.NotSerializableException; | ||
import java.io.ObjectInputStream; | ||
import java.io.ObjectOutputStream; | ||
|
||
import org.omg.CORBA.LocalObject; | ||
import org.omg.PortableInterceptor.ForwardRequest; | ||
import org.omg.PortableInterceptor.ServerRequestInfo; | ||
import org.omg.PortableInterceptor.ServerRequestInterceptor; | ||
|
||
public class YasfServerInterceptor extends LocalObject implements ServerRequestInterceptor { | ||
private static final String NAME = YasfServerInterceptor.class.getName(); | ||
|
||
@Override | ||
public void receive_request_service_contexts(ServerRequestInfo ri) throws ForwardRequest { | ||
} | ||
|
||
@Override | ||
public void receive_request(ServerRequestInfo ri) throws ForwardRequest { | ||
} | ||
|
||
@Override | ||
public void send_reply(ServerRequestInfo ri) { | ||
ri.add_reply_service_context(Yasf.build().sc(), false); | ||
} | ||
|
||
@Override | ||
public void send_exception(ServerRequestInfo ri) throws ForwardRequest { | ||
ri.add_reply_service_context(Yasf.build().sc(), false); | ||
} | ||
|
||
@Override | ||
public void send_other(ServerRequestInfo ri) throws ForwardRequest { | ||
ri.add_reply_service_context(Yasf.build().sc(), false); | ||
} | ||
|
||
@Override | ||
public String name() { | ||
return NAME; | ||
} | ||
|
||
@Override | ||
public void destroy() { | ||
} | ||
|
||
private void readObject(ObjectInputStream ios) throws IOException { | ||
throw new NotSerializableException(NAME); | ||
} | ||
|
||
private void writeObject(ObjectOutputStream oos) throws IOException { | ||
throw new NotSerializableException(NAME); | ||
} | ||
} |